import React, { lazy } from "react";
import {
  AppstoreOutline,
  UserOutline,
  MessageOutline,
  AppOutline,
} from "antd-mobile-icons";

const MainLayout = lazy(() => import("../pages/MainLayout"));
const Login = lazy(() => import("../pages/Login"));
const Register = lazy(() => import("../pages/Register"));
const Home = lazy(() => import("../pages/Home"));
const Props = lazy(() => import("../pages/Props"));
const Message = lazy(() => import("../pages/Message"));
const User = lazy(() => import("../pages/User"));
const City = lazy(() => import("../pages/City"));
const Detail = lazy(() => import("../pages/Detail"));
const NotFound = lazy(() => import("../pages/404"));
const List = lazy(() => import("../pages/List"));
const Order = lazy(() => import("../pages/Order"));
const AddTickPerson = lazy(() => import("../pages/AddTickPerson"));
const OrderConfirm = lazy(() => import("../pages/OrderConfirm"));
const Success = lazy(() => import("../pages/Success"));

//搭建二级路由表
export const RouteChildrenList = [
  {
    path: "/",
    element: <Home />,
    title: "首页",
    icon: AppOutline,
  },
  {
    path: "/props",
    element: <Props />,
    title: "分类",
    icon: <AppstoreOutline />,
  },
  {
    path: "/message",
    element: <Message />,
    title: "消息",
    icon: <MessageOutline />,
  },
  {
    path: "/user",
    element: <User />,
    title: "我的",
    icon: <UserOutline />,
  },
];

//搭建一级路由表
export const RoutesList = [
  {
    path: "/",
    element: <MainLayout />,
    children: RouteChildrenList,
  },
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/register",
    element: <Register />,
  },
  {
    path: "/detail/:id",
    element: <Detail />,
  },
  {
    path: "/order",
    element: <Order />,
  },
  {
    path: "/orderconfirm",
    element: <OrderConfirm />,
  },
  {
    path: "/list",
    element: <List />,
  },
  {
    path: "/city/:type",
    element: <City />,
  },
  {
    path: "/addtickperson",
    element: <AddTickPerson />,
  },
  {
    path: "/success",
    element: <Success />,
  },
  {
    path: "*",
    element: <NotFound />,
  },
];
